package com.wangsanfei.util;

import java.util.List;

public class StringUtils {

	/**
	 * 判断string是否为null或""
	 */
	public static boolean isEmpty(String string) {
		return (string == null || string.trim().length() == 0);
	}

	/** String[] is null or length==0 ? */
	public static boolean isEmpty(String[] string) {
		return (string == null || string.length == 0);
	}

	/** int[] is null or length==0 ? */
	public static boolean isEmpty(int[] string) {
		return (string == null || string.length == 0);
	}

	/** List is null or size==0 ? */
	public static boolean isEmpty(List<? extends Object> list) {
		return (list == null || list.size() == 0);
	}
	
	/** 
	 * 去除字符串中所包含的空格（包括:空格(全角，半角)、制表符、换页符等） 
	 * @param s 
	 * @return 
	 */  
	public static String removeAllBlank(String s){  
	    String result = "";  
	    if(null!=s && !"".equals(s)){  
	        result = s.replaceAll("[　*| *| *|//s*]*", "");  
	    }  
	    return result;  
	}  
	  
	/** 
	 * 去除字符串中头部和尾部所包含的空格（包括:空格(全角，半角)、制表符、换页符等） 
	 * @param s 
	 * @return 
	 */  
	public static String trim(String s){  
	    String result = "";  
	    if(null!=s && !"".equals(s)){  
	        result = s.replaceAll("^[　*| *| *|//s*]*", "").replaceAll("[　*| *| *|//s*]*$", "");  
	    }  
	    return result;  
	}  
	
}
